package trab_sd;

import java.net.*;
import java.io.*;

public class UserID implements Serializable
{
	private String ip;
	private String name;
	private int port;
	
	//construtor
	public UserID ( String ip, String name, int port )
	{
		this.ip = ip;
		this.name = name;
		this.port = port;
	}
	
	//getters
	public String getIP()
	{
		return ip;
	}
	
	public String getName()
	{
		return name;
	}
	
	public int getPort()
	{
		return port;
	}
	
	public String toString()
	{
		return String.format("%-21s %-10s %-5s", name, ip, port);
	}
	
	public boolean equals( UserID comp )
	{
		return comp.getIP().equals(ip) && comp.getPort() == port;
	}
}
